BX.ready(function(){var e=null;var t=[];var a=30;var n=[];var s=[];var i=["2FC6F6","55D0E0","9DCF00","F7A700","AF9245","177CE2","1EAE43","D2000D","828B95","B7EB81","2066B0","B7EB81","47E4C2","525C69","FD6ABB","DEE1E8","7AA5DA","8C5725","6B52CC","FF799C"];function l(e,t){if(e.end<t.end){return 1}if(e.end>t.end){return-1}return 0}function r(e,t){e=n.indexOf(e.id);t=n.indexOf(t.id);if(e<t){return-1}if(e>t){return 1}return 0}function o(){var e=BX("appHistoryChart");BX.cleanNode(e);var t=BX.create("div",{attrs:{className:"main-grid-empty-block"}});var a=BX.create("div",{attrs:{className:"main-grid-empty-inner"}});BX.append(BX.create("div",{attrs:{className:"main-grid-empty-image"}}),a);BX.append(BX.create("div",{attrs:{className:"main-grid-empty-text"},text:BX.message("REST_STATISTIC_EMPTY_DATA")}),a);BX.append(a,t);BX.append(t,e)}function d(d,c){if(typeof d=="object"){var f=false;d.forEach(function(e,o){if(d[o].segments.length>0&&!n.length>0){d[o].segments.sort(l);d[o].segments.forEach(function(e,t){n[t]=e.id});c.forEach(function(e,t){if(n.indexOf(e)===-1){n[n.length]=e}})}else{d[o].segments.sort(r)}d[o].segments.forEach(function(e,n){if(n>a){d[o].segments[a]["end"]+=d[o].segments[n]["end"]}else{var l="000000";if(typeof s[e.id]!=="undefined"){l=s[e.id]}else{if(t.length===0){t=i.slice()}l=t[0];t.splice(0,1);s[e.id]=l}d[o].segments[n].color="#"+l}});if(d[o].segments.length>a){f=true;d[o].segments[a].title=CRestStatisticComponent.langRemain;key=a+1;d[o].segments.splice(key,d[o].segments.length)}});if(f===true){var g=[];var m=[];d.forEach(function(e,t){g[t]=0;m[t]=0;if(d[t].segments.length>0){for(var a=0;a<d[t].segments.length-1;a++){g[t]+=d[t].segments[a].end}m[t]=d[t].segments[d[t].segments.length-1].end}});var p=Math.max.apply(null,m);d.forEach(function(e,t){if(g[t]*1.5<p){d[t].segments[d[t].segments.length-1].end+=g[t];d[t].segments[d[t].segments.length-1].title=CRestStatisticComponent.langLotOf;d[t].segments.splice(0,d[t].segments.length-1)}})}if(d.length>0){if(e!==null){e.dataProvider=d;e.validateData()}else{AmCharts.makeChart("appHistoryChart",{type:"gantt",theme:"light",valueAxis:{stackType:"regular",autoGridCount:true,title:CRestStatisticComponent.langQuery,axisAlpha:.3,gridAlpha:0},balloon:{borderThickness:0,shadowAlpha:0,lineAlpha:0},graph:{fillAlphas:.8,lineAlpha:.3,labelColor:"#fff",labelPosition:"middle",lineColor:"#fff",type:"column",columnWidth:.5,useLineColorForBulletBorder:false,balloonFunction:function(e){return'<div class="restStatisticChartBalloon">'+'<div class="restStatisticChartBalloonTitle"><span>'+e.graph.customData.title+"</span></div>"+'<div class="restStatisticChartBalloonCount"><b>'+e.graph.customData.end+"</b></div>"+"</div>"}},rotate:false,categoryField:"category",segmentsField:"segments",colorField:"color",startField:"start",endField:"end",chartCursor:{cursorColor:"#55bb76",valueBalloonsEnabled:false,cursorAlpha:0,valueLineAlpha:.5,valueLineBalloonEnabled:false,valueLineEnabled:false,zoomable:false,valueZoomable:false},categoryAxis:{gridPosition:"start",axisAlpha:0,gridAlpha:0,labelRotation:45,position:"left"},dataProvider:d})}}else{o()}}else{o()}}function c(){BX.ajax.runComponentAction("bitrix:rest.statistic","getChartData",{mode:"class",signedParameters:CRestStatisticComponent.signetParameters}).then(function(e){if(typeof e.data=="object"&&typeof e.data.dataProvider=="object"&&typeof e.data.idList=="object"){d(e.data.dataProvider,e.data.idList)}else{o()}})}BX.addCustomEvent("BX.Main.Filter:apply",BX.delegate(function(e,t){if(typeof CRestStatisticComponent=="object"&&CRestStatisticComponent.filterName==e){c()}else{o()}}));c()});
//# sourceMappingURL=script.map.js